package org.ailoli.aixiang.model

import io.reactivex.rxjava3.core.Observable
import org.ailoli.aixiang.bean.GetQrCodeUrlBean
import org.ailoli.aixiang.bean.LoginBean
import org.ailoli.aixiang.contract.MainContract
import org.ailoli.aixiang.net.RetrofitClient
import retrofit2.Retrofit

class MainModel: MainContract.Model {
    override fun login(clientId: String?, clientSecret: String?): Observable<LoginBean?>? {
        val options: MutableMap<String?, Any?> = HashMap<String?, Any?>()
        options.put("client_id", clientId!!)
        options.put("client_secret", clientSecret!!)
        return RetrofitClient.service.login(options!!)
    }

    override fun getQrCodeUrl(cabinetId: String): Observable<GetQrCodeUrlBean>? {
        val options: MutableMap<String?, Any?> = HashMap<String?, Any?>()
        options.put("cabinetNo", cabinetId!!)
        return RetrofitClient.service.getQrCodeUrl(options!!)
    }

}